"""
    输出10次 你好
"""
i = 0
sub = 0
# 通过计数器控制
while i <= 100:
    print("你好")
    sub = sub + i
    i += 2
print(sub)

# 判断你是否可以被2整除，可以就累加
sub = 0
i = 1
while i <= 100:
    if (i % 2 == 0):
        sub += i
    i += 1
print(sub)

# continue break
# 逢七必过,输出不包含7的树
j = 0
while j < 30:
    if (j % 7 == 0):
        j += 1
        continue
    print(j)
    j += 1

print("------------------遇到七就不干了  break--------------")

# 循环嵌套 ，办理有10个同学，每个同学都说三遍早上好
stu = 1
while stu <= 10:
    print(f"我是第【{stu}】个同学")
    stu += 1
    num = 0
    while num < 3:
        print("早上好！")
        num += 1

# 简单打印四行星星
print("------------------简单打印四行星星--------------")
star = 0
while star < 4:
    print("*************")
    star += 1

print("------------------10行每行个数不同--------------")

line = 0
while line < 10:
    num = 0
    while num <= line:
        print("*", end="")
        num += 1
    print("")
    line += 1

print("------------------打印九九乘法表--------------")
x = 1
while x <= 9:
    y = 1
    while y <=x:
        print(f"{y}*{x}={y*x}",end="\t")
        y+=1
    print("")
    x+=1

print("------------------打印9层金字塔--------------")
# 第i行前面有n-i个空格
level = 1
while level <=10:
    blank = 1
    num = 1
    while blank <= (10-level):  # 如果学了字符串的拼接这里会优化掉一些
        print(" ",end="")
        blank +=1
    while num <= level:
        print("* ",end="")
        num +=1
    print("\n",end="")
    level += 1


